import type { AppConfig, ComponentCustomProperties } from "vue";
import type { DictsItem } from '@/common/request/api'
import type { RouteJumpPath } from '@/common/utils'
import type { routeJump } from '@/common/utils';
import type {pageLink} from '@/common/stores/init'
import type {VueProxy} from "@/common/hooks";

interface UniAppConfig extends AppConfig {
	globalProperties : Record<string, any> & ComponentCustomProperties & VueProxy
}

type ToastApp = (msg : string) => void
type Toast = (msg : string, iType ?: string, mask ?: boolean, ok ?: () => void, fail ?: () => void) => void
type ModalParams = {
	title ?: string
	content ?: string
	showCancel ?: boolean
	cancelText ?: string
	cancelColor ?: string
	confirmText ?: string
	confirmColor ?: string
	editable ?: boolean
	placeholderText ?: string
	success ?: (res : { confirm : boolean }) => void
	fail ?: () => void
	complete ?: () => void
}
type ShowModal = (parmas : ModalParams) => void
type GoLogin = (params ?: {
	isShowModal ?: boolean,
	goToUrl ?: string,
	wxJumpType ?: string
}) => void
type LayoutGoTo = (link : pageLink, pageTitle ?: string) => void

type JumpParams = [RouteJumpPath, Record<string, any> | undefined,Parameters<typeof routeJump>[2]|undefined,Parameters<typeof routeJump>[3]|undefined]
	|[RouteJumpPath, Record<string, any> | undefined,Parameters<typeof routeJump>[2]|undefined]
	|[RouteJumpPath, Record<string, any> | undefined]
	| [RouteJumpPath]
interface RouteJump {
	(...args : JumpParams) : void
}
type BackFn = (delta ?: number) => void
type CopyFn = (content : string, backCall ?: (() => void) | boolean) => void
type calculateFn = (arg1 : string | number, arg2 : string | number) => number
type SelectDictLabel = (datas : Array<DictsItem>, value : number) => string
type FormatNumberToK = (value : string | number) => string


export type {
	ToastApp,
	Toast,
	ModalParams,
	ShowModal,
	GoLogin,
	LayoutGoTo,
	JumpParams,
	RouteJump,
	BackFn,
	CopyFn,
	calculateFn,
	SelectDictLabel,
	UniAppConfig,
	FormatNumberToK
}